import QtQuick 2.2
import QtQuick.Layouts 1.1


Rectangle {

    property string content: ""
    property string imagepath: ""
    property string imagepath_tmp: ""
    property int flag: 0
    property bool isclick: false
    signal selectItem(int flag, string text, string picpath)
    //   signal message(string content, string picpath)

    width: 50; height: 50
    // border.color: "#C0C0C0"; border.width:1
    //color: "lightgreen"
    // 赋值给图片
    //    function setImage(path)
    //    {
    //        image.source = path
    //    }

    //    // 赋值给文字
    //    function setText(content)
    //    {
    //        text.text = content
    //    }

    MouseArea{
        onClicked:
        {
        }

        onPressed:
        {
            if(flag === 0)
                color = qsTr("#00ACB6")
            else if(flag === 1)
                color = qsTr("white")
        }
        onReleased:
        {
            if(flag === 0)
                color = qsTr("white")
            else if(flag === 1)
                color = qsTr("#C0C0C0")
        }
        anchors.fill: parent
    }
    Column
    {
        spacing: 5
        Image
        {
            id: image
            width: parent.width
            height: parent.height*4/5
           source: imagepath
//            source: "../../images/backup.png"
            // anchors.left:  parent.left
        }
        Text {
            id: text
            width: parent.width
            color: parent.enabled?"black":"#888888"
            text: content
           // text: "backup"
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignHCenter
            fontSizeMode: Text.VerticalFit
            font.pixelSize: 24
            //   text: qsTr("text")
            // anchors.left: image.right
        }

        anchors.fill: parent
    }

}



